Skip to content

fix: print signature in codemap snippet terminal output#119

Merged
SutuSebastian merged 1 commit into
mainfrom
fix/snippet-terminal-signature
May 20, 2026
Merged

fix: print signature in codemap snippet terminal output#119
SutuSebastian merged 1 commit into
mainfrom
fix/snippet-terminal-signature

Conversation

@SutuSebastian
Copy link
Copy Markdown
Contributor

@SutuSebastian SutuSebastian commented May 20, 2026

Summary

Terminal codemap snippet documented location + signature + source but only printed location + source. Now matches codemap show: indented signature line before the source body.

Test plan

  • renderSnippetTerminal unit test
  • bun test src/cli/cmd-snippet.test.ts
  • bun run typecheck
  • CI green

Summary by CodeRabbit

  • Bug Fixes

    • The codemap snippet command now displays symbol signature information in terminal output, consistent with codemap show behavior.
  • Tests

    • Added test coverage for snippet terminal output formatting.

Review Change Stack

Match codemap show: location, indented signature, then source body.
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 20, 2026

🦋 Changeset detected

Latest commit: 2fa5108

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@stainless-code/codemap Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

📝 Walkthrough

Walkthrough

The codemap snippet command terminal output now includes symbol signatures on a dedicated indented line, matching the codemap show contract. The rendering function is exported for testability, and test coverage verifies the output order: match location header, signature, then source content.

Changes

Snippet Signature Terminal Output

Layer / File(s) Summary
Terminal signature rendering
src/cli/cmd-snippet.ts
renderSnippetTerminal is exported (formerly internal renderTerminal) and updated to print each match's signature on an indented line before source output; runSnippetCmd calls the renamed function.
Terminal output tests
src/cli/cmd-snippet.test.ts
Import renderSnippetTerminal and add a test suite that verifies console output includes match header, signature line, and source content in order.
Changeset documentation
.changeset/fix-snippet-terminal-signature.md
Document the patch release: codemap snippet terminal output now includes symbol signatures, aligned with the documented contract and codemap show behavior.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A snippet now shows its true face, 🐰
With signatures printed in place,
Each match in a line,
Makes output divine—
The contract at last finds its grace! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding signature output to the codemap snippet command's terminal display, which aligns with the changeset and code modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/snippet-terminal-signature

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/cli/cmd-snippet.ts (1)

200-224: ⚡ Quick win

Add public API docs for renderSnippetTerminal.

This function is exported, so it should have a concise JSDoc describing its output contract.

Proposed diff
+/**
+ * Render snippet matches in terminal order: location header, signature, then source.
+ * Emits stderr hints for disambiguation and stale snippets.
+ */
 export function renderSnippetTerminal(result: SnippetResult): void {

As per coding guidelines: **/*.{ts,tsx,js,jsx}: All public APIs must have accompanying documentation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/cli/cmd-snippet.ts` around lines 200 - 224, Add a concise JSDoc above the
exported function renderSnippetTerminal(SnippetResult) describing its public
API: explain that it prints snippet matches to stdout and
disambiguation/staleness messages to stderr, describe the output format
("file_path:line_start-line_end" followed by signature and optional source) and
side effects (prints blank line between matches, sets anyStale behavior), and
document the parameter type (SnippetResult) and that the function returns void;
include at least one short sentence about when stderr is used (disambiguation
and stale notices).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/cli/cmd-snippet.ts`:
- Around line 200-224: Add a concise JSDoc above the exported function
renderSnippetTerminal(SnippetResult) describing its public API: explain that it
prints snippet matches to stdout and disambiguation/staleness messages to
stderr, describe the output format ("file_path:line_start-line_end" followed by
signature and optional source) and side effects (prints blank line between
matches, sets anyStale behavior), and document the parameter type
(SnippetResult) and that the function returns void; include at least one short
sentence about when stderr is used (disambiguation and stale notices).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9e29fc09-6d74-42e5-9fc0-811549a9f47f

📥 Commits

Reviewing files that changed from the base of the PR and between 665c19a and 2fa5108.

📒 Files selected for processing (3)
  • .changeset/fix-snippet-terminal-signature.md
  • src/cli/cmd-snippet.test.ts
  • src/cli/cmd-snippet.ts

@SutuSebastian SutuSebastian merged commit cf0532b into main May 20, 2026
12 checks passed
@SutuSebastian SutuSebastian deleted the fix/snippet-terminal-signature branch May 20, 2026 16:24
@github-actions github-actions Bot mentioned this pull request May 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant